<?php

namespace App\Console\Commands;

use App\Events\ShopAssetEvents;
use App\Models\Shop;
use App\Services\Asset;
use App\Services\UserAsset;
use App\Models\UserAsset as User;
use App\Services\UserAssetServe;
use App\Services\WxLoginService;
use Illuminate\Console\Command;
use Carbon\Carbon;
use Illuminate\Support\Facades\Cache;
use OSS\OssClient;

class Test extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'test';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'test.';


    /**
     * Execute the console command.
     *
     * @return mixed
     * @throws \OSS\Core\OssException
     */
    public function handle()
    {
        $o = exec('python test3.py 97e27b77994241631d92299070a0982a4c812c1df5a9c2073f8dc217242735ec73a4fabec025be95a7de603a60ecce16292d8834c10c5ca1150499ad9572dc39007e2d0544beaa80420ea6e026c394b1fdd781b2a51e15ce8a09f39136765705951f7f60fddb8bb0956f4474adf0f238d8d2932f5e3da72cb311648ab0ca59f2e0c973c5d7c7aadadc57bf9ea6ef457de3678965a39ad4e8dcac9eb6e775245b408bb3328663a563a481875a889c6569cade7f88a398fe15967a072d73fb292d458d0185dee7257a622db8039acc51edc4262d90abdee9f9dee44ddccf9cf6753f787a0a32e1140ca0d6abd234c059f9a8ca6a69e2857c9a0d47437b29582881 010001 LJP2000920ljp 2>&1',$output, $return_val);
        dd($output);
//        $returnArr = [
//            'userInfo' => [
//                'nick_name'     => 123,
//                'avatar_url'    => 123,
//                'open_id'       => 123,
//                'response_type' => 123,
//            ]
//        ];
//
//        Cache::put('aaaa',json_encode($returnArr));
//
//        $result = Cache::get('aaaa');
//
//        dd(json_decode($result)->userInfo->nick_name);
//        dd(session()->put('aaaaa',12));
//        dd(session()->get('aaaaa'));
//
//        $fileName = 'export_' . time() . '_' . date('Y-m-d_H:i') . '.log';
//        获取上传图片的临时地址
//        $tmpPath = storage_path('logs/laravel.log');
//         生成文件名

        // 上传图片到阿里云OSS
//        $ossClient = new OssClient('LTAI4GD7pzFdmcjq3ZUN9qto', 'XhwaaU0sAWHI4Na6psqseSphIYYAw9', 'http://oss-cn-shanghai.aliyuncs.com');

//        $ossClient->setSignStsInUrl(false);
//        $ossClient->signUrl();
//
//        dd($fileName);

//        $ossClient = new OssClient('LTAI4GD7pzFdmcjq3ZUN9qto', 'XhwaaU0sAWHI4Na6psqseSphIYYAw9', 'http://oss-cn-shanghai.aliyuncs.com');
////        $ossClient->setSignStsInUrl()
//        $result = $ossClient->signUrl('haokeduo','haokeduo.png',1200);
//        dd($result);
//        User::create(['user_id' => 20]);
//        dd((new WxLoginService())->getCode('wxd5cbe2a97520661f',urlencode('http://admin.58xinrui.cn/api/wechat/redirect')));
//        (new UserAssetServe(11,20,10,12,''))->recharge();
//        (new UserAssetServe(21,20,5,12,''))->withdraw();
//        (new Asset(61,13,10,12,''))->unFrozen();
//        (new Asset(42, 13, 10, 12, ''))->expendFromFrozen();
//        (new UserAssetServe(51,20,5,12,''))->frozen();
    }
}
